package Cinema.DataLayer;

import java.util.ArrayList;
import Cinema.User;
import Cinema.CinemaEntities.Movie;
import Cinema.CinemaEntities.Show;
import Cinema.CinemaEntities.Site;
import Exceptions.ObjectAlreadyExist;


/**
 * Interface for a database manager of the Cinema system.
 * @author Fuchtzeinsoft Team
 *
 */
public interface IDataManager {

	/**
	 * Requests to add a new user.
	 * @param newUser - object representing the user we adding.
	 * @throws ObjectAlreadyExist - If the user already exist in the system.
	 */
	public abstract void addUser(User newUser)
			throws ObjectAlreadyExist;

	/**
	 * return the User with the userName and the Password that were provided.
	 * @param userName - The user name of the user.
	 * @param password - The password of the user.
	 * @return The desired user object if user exists and the password was correct, null otherwise.
	 */
	public abstract User getUser(String userName, String password);

	/**
	 * Returns the list of all the movies in the system.
	 * @return List of all the movies in the system.
	 */
	public abstract ArrayList<Movie> getMovies();

	/**
	 * Returns the list of all the sites in the system.
	 * @return List of all the sites in the system.
	 */
	public abstract ArrayList<Site> getSites();

	/**
	 * Returns the list of all shows who plays the wanted movie and have wantedSeatAmount free seats.
	 * @param wantedSeatAmount - The number of seats needed in the show.
	 * @param movie - The movie we want to watch.
	 * @return List of all the shows who plays the wanted movie and have wantedSeatAmount free seats.
	 */
	public abstract ArrayList<Show> getOptionalShowsList(int wantedSeatAmount,
			Movie movie);

	/**
	 * Returns the list of all shows who plays the wanted movie.
	 * @param movie - The movie we want to watch.
	 * @return List of all the shows who plays the wanted movie.
	 */
	public abstract ArrayList<Show> GetShowsForMovie(Movie movie);

	/**
	 * return all shows of specified movie showed in a specified site.
	 * @param movie - whose shows we want to query.
	 * @param site - the hall we are interested in.
	 * @return list of shows sorted by date.
	 */
	public ArrayList<Show> getShowsForMovieInSite(Movie movie, Site site);

	/**
	 * The doBeckupNow function make sure that we will save all the data when the system quits.
	 */
	public void doBackupNow();

}